<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="程月">
    <title>遮罩层</title>
    <style>
        body {
            margin: 0;
            background-color: #ccc;
        }

        * {
            box-sizing: border-box;
        }

        main {
            width: 390px;
            margin: 0 auto;
            font-size: 14px;
        }

        .top,.bottom {
            background-color: #fff;
            color: #666;
        }
        .back{
            position: relative;
            width: 100%;
            height: 451px;
            background-color: #fff;
        }
        .border{
            position: absolute;
            width: 100%;
            height: 451px;
            vertical-align: middle;
            background-color: orange;
            opacity: 0;
        }
        .top {
            width: 380px;
            margin: 0 auto;
            text-align: center;
            padding: 5px 0;
            position: relative;
            top: 5px;
        }

        .bottom {
            margin-top: 15px;
            width: 390px;
            display: flex;
            justify-content: space-between;
            padding: 10px;
        }

        .left,
        .right {
            position: relative;
            overflow: hidden;
        }

        .bg {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background-color: #000;
            opacity: 0;
        }

        .info {
            position: absolute;
            width: 100%;
            height: 100%;
            padding-top: 30px;
            padding-left: 15px;
            top: 0;
            left: -170px;
            color: #fff;
            opacity: 0;
        }
    </style>
</head>

<body>
    <main>
        <div class="back">
          <div class="border"></div>
            <div class="top">
                <img src="./img/1.jpg" alt="">
                <p>【金嘉】设计上运用了多片层叠设计</p>
            </div>
           </div>
        <div class="bottom">
            <section class="left">
                <img src="./img/2.jpg" alt="" class="img1">
                <div class="bg bg1"></div>
                <section class="info info-1">
                    <p>specical品牌旗舰店</p>
                    <span>最具有传奇浪漫色彩的欧洲经典</span>
                </section>
            </section>
            <section class="right">
                <img src="./img/3.jpg" alt="" class="img2">
                <div class="bg bg2"></div>
                <section class="info info-2">
                    <p>specical品牌旗舰店</p>
                    <span>最具有传奇浪漫色彩的欧洲经典</span>
                </section>
            </section>
        </div>
    </main>

    <script src="./jquery.js"></script>
</body>

</html>
<script>

    $('.top').hover(function(){
        $('.border').stop().animate({
            opacity:1
         },500);
    },function(){
        $('.border').stop().animate({
            opacity:0
         },500);
    });
    // ----------------------------------------

    // $('.left').mouseenter(function(){
    //      $('.bg1').stop().fadeTo(1000,0.3);
    //      $('.info-1').stop().animate({
    //         left:0,
    //         opacity:1
    //     },500);
    // });
    // $('.left').mouseleave(function(){
    //     $('.bg1').stop().fadeTo(1000,0);
    //     $('.info-1').stop().animate({
    //         left:-170,
    //         opacity:0
    //     },500);
    // });


    // $('.right').hover(function(){
    //      $('.bg2').stop().fadeTo(500,0.3);
    //      $('.info-2').stop().animate({
    //         left:0,
    //         opacity:1
    //     },500);
    // },function(){
    //     $('.bg2').stop().fadeTo(1000,0);
    //     $('.info-2').stop().animate({
    //         left:-170,
    //         opacity:0
    //     },500);
    // });

    $('.bottom>section').hover(function(){
        $(this).find('.bg').stop().fadeTo(500,0.3);
        $(this).find('.info').stop().animate({
            left:0,
            opacity:1
        },500);
    },function(){
        $(this).find('.bg').stop().fadeTo(500,0);
        $(this).find('.info').stop().animate({
            left:-170,
            opacity:1
        },500);
    });
</script>